package com.gitee.wsl.ext


import com.gitee.wsl.Lib
import com.gitee.wsl.LibConfig
import com.gitee.wsl.eventbus.event4k.Event4k
import com.gitee.wsl.platform.Platform
import com.gitee.wsl.data.store.StoreServer
import com.gitee.wsl.data.store.cache.MemoryStoreServer
import com.gitee.wsl.platform.AppDirs


object ApplicationConfig {

    var globalStoreServer: StoreServer = MemoryStoreServer.defaultServer

    var eventBus: Event4k = Event4k.default

    var isDebug = false

    fun lineSeparator() = Platform.lineSeparator

    var appDirs: AppDirs
        get() = AppDirs.saved
        set(value){
            AppDirs.saved = value
        }
}

val Lib.config:ApplicationConfig get() = ApplicationConfig


fun LibConfig.appConfig(block: ApplicationConfig.() -> Unit) {
    ApplicationConfig.block()
}